load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "session",
    srcs = [
        "advisory_locks.go",
        "bootstrap.go",
        "contextimpl.go",
        "mock_bootstrap.go",
        "nontransactional.go",
        "session.go",
        "sync_upgrade.go",
        "testutil.go",  #keep
        "tidb.go",
        "txn.go",
        "txnmanager.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/session",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/bindinfo",
        "//pkg/config",
        "//pkg/ddl",
        "//pkg/ddl/placement",
        "//pkg/ddl/schematracker",
        "//pkg/ddl/serverstate",
        "//pkg/distsql/context",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor",
        "//pkg/disttask/importinto",
        "//pkg/domain",
        "//pkg/domain/infosync",
        "//pkg/errno",
        "//pkg/executor",
        "//pkg/executor/staticrecordset",
        "//pkg/expression",
        "//pkg/expression/exprctx",
        "//pkg/expression/sessionexpr",
        "//pkg/extension",
        "//pkg/extension/extensionimpl",
        "//pkg/infoschema",
        "//pkg/infoschema/context",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/meta/metabuild",
        "//pkg/meta/model",
        "//pkg/metrics",
        "//pkg/owner",
        "//pkg/param",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/charset",
        "//pkg/parser/format",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/opcode",
        "//pkg/parser/terror",
        "//pkg/planner",
        "//pkg/planner/core",
        "//pkg/planner/core/base",
        "//pkg/planner/core/resolve",
        "//pkg/planner/planctx",
        "//pkg/planner/plannersession",
        "//pkg/plugin",
        "//pkg/privilege",
        "//pkg/privilege/conn",
        "//pkg/privilege/privileges",
        "//pkg/session/cursor",
        "//pkg/session/metrics",
        "//pkg/session/txninfo",
        "//pkg/session/types",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/sessiontxn",
        "//pkg/sessiontxn/isolation",
        "//pkg/sessiontxn/staleread",
        "//pkg/statistics/handle/syncload",
        "//pkg/statistics/handle/usage",
        "//pkg/statistics/handle/usage/indexusage",
        "//pkg/store",
        "//pkg/store/driver/error",
        "//pkg/store/helper",
        "//pkg/store/mockstore",
        "//pkg/table",
        "//pkg/table/tables",
        "//pkg/table/tblctx",
        "//pkg/table/tblsession",
        "//pkg/table/temptable",
        "//pkg/tablecodec",
        "//pkg/testkit/testenv",
        "//pkg/timer/tablestore",
        "//pkg/ttl/ttlworker",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/collate",
        "//pkg/util/dbterror",
        "//pkg/util/dbterror/exeerrors",
        "//pkg/util/dbterror/plannererrors",
        "//pkg/util/execdetails",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/logutil/consistency",
        "//pkg/util/memory",
        "//pkg/util/parser",
        "//pkg/util/ranger/context",
        "//pkg/util/redact",
        "//pkg/util/sem",
        "//pkg/util/sli",
        "//pkg/util/sqlescape",
        "//pkg/util/sqlexec",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/topsql",
        "//pkg/util/topsql/state",
        "//pkg/util/topsql/stmtstats",
        "//pkg/util/tracing",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_log//:log",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//concurrency",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "session_test",
    timeout = "moderate",
    srcs = [
        "bench_test.go",
        "bootstrap_test.go",
        "main_test.go",
        "session_test.go",
        "tidb_test.go",
    ],
    embed = [":session"],
    flaky = True,
    race = "off",
    shard_count = 50,
    deps = [
        "//pkg/autoid_service",
        "//pkg/bindinfo",
        "//pkg/config",
        "//pkg/ddl",
        "//pkg/domain",
        "//pkg/executor",
        "//pkg/expression",
        "//pkg/expression/sessionexpr",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/session/types",
        "//pkg/sessionctx",
        "//pkg/sessionctx/variable",
        "//pkg/statistics",
        "//pkg/store/mockstore",
        "//pkg/table/tblsession",
        "//pkg/testkit/testmain",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/benchdaily",
        "//pkg/util/chunk",
        "//pkg/util/logutil",
        "//pkg/util/sqlexec",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_log//:log",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_atomic//:atomic",  #keep
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)
